<template>
    <view class="container">
        <view class="wrap px-80">
            <view class="py-60 ">
                <view class="fs-35">欢迎使用 陪练小程序</view>
                <view class="fs-25 mt-20 c-777777">登录后可获得更多功能</view>
            </view>
            <view class="mt-120">
                <uv-form>
                    <uv-form-item>
                        <uv-button type="primary" shape="circle" @click="login">微信一键登录</uv-button>
                    </uv-form-item>
                    <uv-form-item>
                        <uv-button plain shape="circle" @click="cancel">取消</uv-button>
                    </uv-form-item>
                    <uv-form-item>
                        <uv-checkbox-group v-model="check">
                            <uv-checkbox shape="circle" :customStyle="{marginBottom: '8px'}" name="true">
                                <label class="flex fs-22">
                                    <text>阅读并同意陪练小程序</text>
                                    <navigator style="display: inline-block"
                                        url="/pages/agreement?url=https://go.yousanxia.com/static/yhzy.html&index=1">
                                        《用户协议》</navigator>和 <navigator style="display: inline-block"
                                        url="/pages/agreement?url=https://go.yousanxia.com/static/yszy.html&index=0">
                                        《隐私政策》
                                    </navigator>
                                </label>
                            </uv-checkbox>
                        </uv-checkbox-group>
                    </uv-form-item>
                </uv-form>


            </view>
        </view>

    </view>
</template>
<script lang="ts" setup>
    import { ref } from "vue";

    import { useAuthStore } from "@/stores/auth.js"
    const authStore = useAuthStore();
    const check = ref([]);
    //登录操作
    const login = () => {
        if (check.value.length == 0) {
            uni.showToast({
                title: "请阅读并同意协议",
                icon: "none"
            })
            return false;
        }
        authStore.login().then(res => {
            if (res) {
                //进入首页
                uni.reLaunch({
                    url: "/pages/index/index"
                })
            }
        })


    }
    const cancel = () => {
        uni.navigateBack();
    }
</script>
<style lang="scss" scoped>
    navigator {
        color: #0061dd;
    }

    .container {
        background-color: #0061dd;

        .wrap {
            background-color: #fff;
            border-top-left-radius: 50rpx;
            border-top-right-radius: 50rpx;

        }
    }
</style>